package br.com.medvagas.web.mb.a;

import java.io.Serializable;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.medvagas.comum.entidade.UsuarioProfissional;
import br.com.medvagas.comum.util.UtilJSF;
import br.com.medvagas.comum.util.UtilSpring;
import br.com.medvagas.negocio.facade.p.IManterProfissional;

@ManagedBean
@ViewScoped
public class ConsultarUsuarioProfissionalMB implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private List<UsuarioProfissional> lsUsuarioProfissional;
	
	public ConsultarUsuarioProfissionalMB() {
		consultarEmpresa();
	}
	
	private void consultarEmpresa() {
		IManterProfissional mp = (IManterProfissional) UtilSpring.getBean(IManterProfissional.NOME);
		this.lsUsuarioProfissional = mp.consultarTodos();
	}
	
	public String excluir() {
		Integer idUsuarioProfissional = Integer.valueOf(UtilJSF.getParameter("idUsuarioProfissional"));

		IManterProfissional mp = (IManterProfissional) UtilSpring.getBean(IManterProfissional.NOME);
		mp.excluirUsuario(idUsuarioProfissional);
		
		consultarEmpresa();
		
		return null;
	}

	public List<UsuarioProfissional> getLsUsuarioProfissional() {
		return lsUsuarioProfissional;
	}
	public void setLsUsuarioProfissional(
			List<UsuarioProfissional> lsUsuarioProfissional) {
		this.lsUsuarioProfissional = lsUsuarioProfissional;
	}
	
}
